home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / gfx / misc / gnuplot-3.7src.lha / gnuplot-3.7src / gnuplot-3.7.lha / gnuplot-3.7 / term / unixplot.trm < prev    next >
Text File  |  1998-11-26  |  5KB  |  185 lines

  1. /*
  2.  * $Id: unixplot.trm,v 1.13 1998/04/14 00:18:13 drd Exp $
  3.  *
  4.  */
  5.  
  6. /* GNUPLOT -- unixplot.trm */
  7.  
  8. /*[
  9.  * Copyright 1990 - 1993, 1998
  10.  *
  11.  * Permission to use, copy, and distribute this software and its
  12.  * documentation for any purpose with or without fee is hereby granted,
  13.  * provided that the above copyright notice appear in all copies and
  14.  * that both that copyright notice and this permission notice appear
  15.  * in supporting documentation.
  16.  *
  17.  * Permission to modify the software is granted, but not the right to
  18.  * distribute the complete modified source code.  Modifications are to
  19.  * be distributed as patches to the released version.  Permission to
  20.  * distribute binaries produced by compiling modified sources is granted,
  21.  * provided you
  22.  *   1. distribute the corresponding source modifications from the
  23.  *    released version in the form of a patch file along with the binaries,
  24.  *   2. add special version identification to distinguish your version
  25.  *    in addition to the base release version number,
  26.  *   3. provide your name and address as the primary contact for the
  27.  *    support of your modified version, and
  28.  *   4. retain our contact information in regard to use of the base
  29.  *    software.
  30.  * Permission to distribute the released version of the source code along
  31.  * with corresponding source modifications in the form of a patch file is
  32.  * granted with same provisions 2 through 4 for binary distributions.
  33.  *
  34.  * This software is provided "as is" without express or implied warranty
  35.  * to the extent permitted by applicable law.
  36. ]*/
  37.  
  38. /*
  39.  * This file is included by ../term.c.
  40.  *
  41.  * This terminal driver supports:
  42.  *  Unix plot(5) graphics language
  43.  *
  44.  * AUTHORS
  45.  *  Colin Kelley, Thomas Williams, Russell Lang
  46.  * 
  47.  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  48.  * 
  49.  */
  50.  
  51. /*
  52.  * Unixplot library writes to stdout.  A fix was put in place by
  53.  * ..!arizona!naucse!jdc to let set term and set output redirect
  54.  * stdout.  All other terminals write to gpoutfile.
  55. */
  56.  
  57. /*
  58.  * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
  59.  */
  60.  
  61. #include "driver.h"
  62.  
  63. #ifdef TERM_REGISTER
  64. register_term(unixplot)
  65. #endif
  66.  
  67. #ifdef TERM_PROTO
  68. TERM_PUBLIC void UP_init __PROTO((void));
  69. TERM_PUBLIC void UP_graphics __PROTO((void));
  70. TERM_PUBLIC void UP_text __PROTO((void));
  71. TERM_PUBLIC void UP_linetype __PROTO((int linetype));
  72. TERM_PUBLIC void UP_move __PROTO((unsigned int x, unsigned int y));
  73. TERM_PUBLIC void UP_vector __PROTO((unsigned int x, unsigned int y));
  74. TERM_PUBLIC void UP_put_text __PROTO((unsigned int x, unsigned int y, char str[]));
  75. TERM_PUBLIC void UP_reset __PROTO((void));
  76.  
  77. #define UP_XMAX 4096
  78. #define UP_YMAX 4096
  79.  
  80. #define UP_XLAST (UP_XMAX - 1)
  81. #define UP_YLAST (UP_YMAX - 1)
  82.  
  83. #define UP_VCHAR (UP_YMAX/30)    /* just a guess--no way to know this! */
  84. #define UP_HCHAR (UP_XMAX/60)    /* just a guess--no way to know this! */
  85. #define UP_VTIC (UP_YMAX/80)
  86. #define UP_HTIC (UP_XMAX/80)
  87. #endif /* TERM_PROTO */
  88.  
  89. #ifndef TERM_PROTO_ONLY
  90. #ifdef TERM_BODY
  91.  
  92. TERM_PUBLIC void UP_init()
  93. {
  94.     openpl();
  95.     space(0, 0, UP_XMAX, UP_YMAX);
  96. }
  97.  
  98.  
  99. TERM_PUBLIC void UP_graphics()
  100. {
  101.     erase();
  102. }
  103.  
  104.  
  105. TERM_PUBLIC void UP_text()
  106. {
  107.     /* empty */
  108. }
  109.  
  110.  
  111. TERM_PUBLIC void UP_linetype(linetype)
  112. int linetype;
  113. {
  114.     static char *lt[2 + 5] = {"solid", "longdashed", "solid", "dotted",
  115.      "shortdashed", "dotdashed", "longdashed"};
  116.  
  117.     if (linetype >= 5)
  118.     linetype %= 5;
  119.  
  120.     linemod(lt[linetype + 2]);
  121. }
  122.  
  123.  
  124. TERM_PUBLIC void UP_move(x, y)
  125. unsigned int x, y;
  126. {
  127.     move(x, y);
  128. }
  129.  
  130.  
  131. TERM_PUBLIC void UP_vector(x, y)
  132. unsigned int x, y;
  133. {
  134.     cont(x, y);
  135. }
  136.  
  137.  
  138. TERM_PUBLIC void UP_put_text(x, y, str)
  139. unsigned int x, y;
  140. char str[];
  141. {
  142.     UP_move(x + UP_HCHAR / 2, y + UP_VCHAR / 5);
  143.     label(str);
  144. }
  145.  
  146. TERM_PUBLIC void UP_reset()
  147. {
  148.     closepl();
  149. }
  150.  
  151. #endif /* TERM_BODY */
  152.  
  153. #ifdef TERM_TABLE
  154. TERM_TABLE_START(unixplot_driver)
  155.     "unixplot", "Unix plotting standard (see plot(1))",
  156.     UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR,
  157.     UP_VTIC, UP_HTIC, options_null, UP_init, UP_reset,
  158.     UP_text, null_scale, UP_graphics, UP_move, UP_vector,
  159.     UP_linetype, UP_put_text, null_text_angle,
  160.     null_justify_text, line_and_point, do_arrow, set_font_null
  161. TERM_TABLE_END(unixplot_driver)
  162.  
  163. #undef LAST_TERM
  164. #define LAST_TERM unixplot_driver
  165.  
  166. #endif /* TERM_TABLE */
  167. #endif /* TERM_PROTO_ONLY */
  168.  
  169. #ifdef TERM_HELP
  170. START_HELP(unixplot)
  171. "1 unixplot",
  172. "?comands set terminal unixplot",
  173. "?set terminal unixplot",
  174. "?set term unixplot",
  175. "?terminal unixplot",
  176. "?term unixplot",
  177. "?unixplot",
  178. " The `unixplot` terminal driver generates output in the Unix \"plot\" graphics",
  179. " language.  It has no options.",
  180. "",
  181. " This terminal cannot be compiled if the GNU version of plot is to be used;",
  182. " in that case, use the `gnugraph` terminal instead."
  183. END_HELP(unixplot)
  184. #endif
  185.